<extend name="Public:main"/>
<block name="title">分享好友</block>
<block name="body">
    <body  ng-app="myApp" ng-controller="Ctrl" ng-cloak>
        <div class="nav_top flex">
            <a  href="javascript:void(0)"  onclick="window.history.go(-1)">
                <i></i>
            </a>
            <div class="flex1">
                分享记录
            </div>
            <a href="javascript:void(0)">
                <i></i>
            </a>
        </div>
        <div style="height: 0.44rem;"></div>
        <!--<div class="ba_list clearfix">
            <ul>
                <li>UID</li>
                <li>手机号</li>
                <li>时间</li>
            </ul>
        </div>
        <div style="height: 0.4rem;"></div>-->
       <!-- <div class="list_show">
            <ul class="clearfix"  ng-repeat="log in logs">
                    <li>
                        <div>
                            {{log.id}}
                        </div>
                        <div>
                            {{log.account}}
                        </div>
                        <div>
                            {{log.createtime}}
                        </div>
                    </li>
            </ul>
        </div>-->
        <div class="pay_list">
            <ul>
                <li class="flex" ng-repeat="log in logs">
                    <div ng-if="log.profilephoto !='' && log.profilephoto !=null" style="height: 0.75rem;width: 0.75rem;">
                        <img ng-src="{{log.profilephoto}}" style="height: 100%;border-radius: 50%">
                    </div>
                    <div ng-if="log.profilephoto =='' || log.profilephoto ==null" style="height: 0.75rem;width: 0.75rem;">
                        <img ng-src="__PUBLIC__/vpay/images/shezhi_icon_head.png" style="height: 100%;border-radius: 50%">
                    </div>
                    <div class="flex1">
                        <label style="margin-left: 0.12rem;color: black">
                            {{log.nickname}}({{log.id}})
                        </label>
                        <div style="color: #6b7d86;font-size: 1px;">
                            <p>手机号：{{log.account}}</p>
                            <p>分享时间：{{log.createtime}}</p>
                        </div>
                        <!--<div style="color: #6b7d86;">
                        </div>-->
                    </div>
                </li>
            </ul>
        </div>
    </body>
    <block name="custom_js">
        <script type="text/javascript">
            var app = getApp('myApp', []);
            app.controller('Ctrl', function ($scope, $http) {
                // 当前页数
                $scope.p = 0;
                // 加载完毕标志
                $scope.endflg = 0;
                // 防止重复加载
                $scope.busy = false;
                // 存放列表数据
                $scope.logs = [];
                //存放所有数据
                $scope.res = "";
                // 请求数据方法
                $scope.loadMore = function () {
                    if ($scope.endflg == 0) {
                        if ($scope.busy) {
                            return false;
                        }
                        $scope.busy = true;
                        $http({
                            method: 'POST',
                            data: {
                                "p": $scope.p
                            },
                            headers: {'Content-Type': 'application/x-www-form-urlencoded'},
                            transformRequest: function (obj) {
                                var str = [];
                                for (var p in obj) {
                                    str.push(encodeURIComponent(p) + "=" + encodeURIComponent(obj[p]));
                                }
                                return str.join("&");
                            },
                            url: "/index.php/Home/Member/share_detail"
                        }).then(function successCallback(response) {
                            $scope.busy = false;
                            if (response.data.data != '' && response.data.data != null) {
                                if ($scope.p > 0) {
                                    layer.msg("正在加载...", {time: 500});
                                }
                            } else {
                                layer.msg("已经全部加载完了...", {time: 500});
                                $scope.endflg = 1;
                                return false;
                            }
                            $scope.p++;
                            if (response.data.code == -1) {
                                layer.msg(response.data.msg, {time: 1500})
                            } else {
                                if (response.data.data == null) {
                                    layer.msg(response.data.msg, {time: 1500});
                                } else {
                                    // 组织数据
                                    for (var i in response.data.data) {
                                        $scope.logs.push(response.data.data[i]);
                                    }
                                }
                            }
                        }, function errorCallback(response) {
                            errorHandle(response);
                        });
                    } else {
                        layer.msg("已经全部加载完了...", {time: 500});
                    }
                };
                // 进页面先加载一次数据
                $scope.loadMore();
            })
        </script>
    </block>
</block>